﻿@{
    ViewBag.Title = "Common Command";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
        <ol class="breadcrumb">
            <li><a href="/Home.html">Home</a></li>
            <li><a href="/WebApp/WebApi"> Sanelib WebApp</a></li>
            <li class="active">Redirection Operator</li>
        </ol>
       
            <div id="introduction">
                <h1 class="text-left">Windows PowerShell Redirection OPERATORS</h1>
            </div>
            <div>
                <p>
                    Window PowerShell  redirection operator use the send particular type of output in a text file
                </p>
            </div>
            <div id="type">
                <h3>Output are defined in several types such as :</h3>
                <table class="table table-bordered">
                    <tr>
                        <td>All Output</td>
                        <td>*</td>
                    </tr>
                    <tr>
                        <td>Success Output</td>
                        <td>1</td>
                    </tr>
                    <tr>
                        <td>Errors Output</td>
                        <td>2</td>
                    </tr>
                    <tr>
                        <td>Warning Message</td>
                        <td>3</td>
                    </tr>
                    <tr>
                        <td>Verbose Output</td>
                        <td>4</td>
                    </tr>
                    <tr>
                        <td>Debug Message</td>
                        <td>5</td>
                    </tr>
                </table>
            </div>
            <div id="syntax">
                <p>-	The <b>syntax</b> of the redirection operators is as follows:</p>
                <div class="divcolor">
                    <pre><code>&lt;input&gt; &lt;operator&gt; [&lt;path&gt;\]&lt;file&gt;</code></pre>
                </div>

                <p>If the specified file already exists, the redirection operators that do not append data (> and n>) overwrite the current contents of the file without warning.</p>
                <p><b>Note : </b>The All (*) , Warning (3) , Verbose (4) , Debug (5) redirection operator were introduced in windows PowerShell version 3.0 they are not used in earlier version of PowerShell</p>
            </div>
            <div id="Exampletable">
                <p>-	Windows PowerShell Redirection Operator are as follows</p>
                <table class="table table-bordered">
                    <tr>
                        <th>Operator</th>
                        <th>Description</th>
                        <th>Example</th>
                    </tr>
                    <tr>
                        <td>></td>
                        <td>Send output to the specified file</td>
                        <td>Get-Process > process.txt</td>
                    </tr>
                    <tr>
                        <td>>></td>
                        <td>Append output from the specified file</td>
                        <td>Get-Content first.txt > output.txt</td>
                    </tr>
                    <tr>
                        <td>2></td>
                        <td>Send error to the specified file</td>
                        <td>Get-Process none 2> error.txt</td>
                    </tr>
                    <tr>
                        <td>2>></td>
                        <td>Append error content to the specified file</td>
                        <td>Get-Process none 2> append-error.txt</td>
                    </tr>
                    <tr>
                        <td>2>&1</td>
                        <td>Sends errors (2) and success output (1) to the success output stream.</td>
                        <td>Get-Process none, Powershell 2>&1</td>
                    </tr>
                    <tr>
                        <td>3></td>
                        <td>Send warning message to the specified file</td>
                        <td>Write-Warning “Test!” 3> warning.txt</td>
                    </tr>
                    <tr>
                        <td>3>></td>
                        <td>Append warning message to the specified file</td>
                        <td>Write-Warning “Test!” 3>> warning.txt</td>
                    </tr>
                    <tr>
                        <td>3>&1</td>
                        <td>Sends warning (3) and success output (1) to the success output stream.</td>
                        <td>function Test_Warning<br />
                            {Get-Process powershell;
                            Write-Warning “Test!” }
                            Test_Warning 3>&1
                        </td>
                    </tr>
                    <tr>
                        <td>4></td>
                        <td>Send verbose to the specified file</td>
                        <td>Import-Module * -Verbose 4> Verbose.txt</td>
                    </tr>
                    <tr>
                        <td>4>></td>
                        <td>Append verbose content to the specified file</td>
                        <td>Import-Module * -Verbose 4>> Verbose.txt</td>
                    </tr>
                    <tr>
                        <td>4>&1</td>
                        <td>Sends verbose (4) and success output (1) to the success output stream.</td>
                        <td>Import-Module * -Verbose 4>&2</td>
                    </tr>
                    <tr>
                        <td>5></td>
                        <td>Send debug message to the specified file</td>
                        <td>Write-Debug “Test!” 5> warning.txt</td>
                    </tr>
                    <tr>
                        <td>5>></td>
                        <td>Append debug message to the specified file</td>
                        <td>Write- Debug “Test!” 5>> warning.txt</td>
                    </tr>
                    <tr>
                        <td>5>&1</td>
                        <td>Sends debug message (5) and success output (1) to the success output stream.</td>
                        <td>function Test_Debug<br />{
                            Get-Process powershell
                            Write- Debug “Test!” }
                            Test_ Debug 5>&1
                        </td>
                    </tr>
                </table>
            </div>
            <div id="exalloutput">
                <p>For the All(*) operator first create the function of the Test-Output</p>
                <img src="Images/functionredop.png" class="img-thumbnail" alt="function for the all(*) output" /><br />
                <p>Then After Perform the operation</p>
                <table class="table table-bordered">
                    <tr>
                        <th>Operator</th>
                        <th>Description</th>
                        <th>Example</th>
                    </tr>
                    <tr>
                        <td>*></td>
                        <td>Send all output to the specified file</td>
                        <td>Test-Output *> test-output.exe</td>
                    </tr>
                    <tr>
                        <td>*>></td>
                        <td>Append all output content to the specified file</td>
                        <td>Test-Output *>> test-output.exe</td>
                    </tr>
                    <tr>
                        <td>*>&1</td>
                        <td>Send all output (2) and success output (1) to the success output stream.</td>
                        <td>Test-Output *>&1</td>
                    </tr>
                </table>
            </div>
       